package com.demo.web.service.impl;

import com.demo.web.dao.LearnResouceMapper;
import com.demo.web.domain.LearnResouce;
import com.demo.web.service.LearnResouceService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: KUN
 * @Date: 2018/3/7 15:20
 */
@Service
public class LearnResouceServiceImpl implements LearnResouceService {
    @Autowired
    LearnResouceMapper learnResouceMapper;

    @Override
    public int add(LearnResouce learnResouce) {
        return this.learnResouceMapper.add(learnResouce);
    }

    @Override
    public int update(LearnResouce learnResouce) {
        return this.learnResouceMapper.update(learnResouce);
    }

    @Override
    public int deleteByIds(String[] ids) {
        return this.learnResouceMapper.deleteByIds(ids);
    }

    @Override
    public LearnResouce queryLearnResouceById(Long id) {
        return this.learnResouceMapper.queryLearnResouceById(id);
    }

    @Override
    public List<LearnResouce> queryLearnResouce(Map<String, Object> params) {
        PageHelper.startPage(Integer.parseInt(params.get("page").toString()),Integer.parseInt(params.get("rows").toString()));
        return this.learnResouceMapper.queryLearnResouceList(params);
    }
}
